import request from '@/utils/request'

export function getIndex() {
  return request({
    url: '/mall/index',
    method: 'get'
  })
}

export function getSelect() {
  return request({
    url: '/mall/indexSelect',
    method: 'get'
  })
}

export function addCart(data) {
  return request({
    url: '/cart/add',
    method: 'post',
    data
  })
}

export function getProductById(data) {
  return request({
    url: '/mall/product_info',
    method: 'post',
    data
  })
}

export function getCartById(data) {
  return request({
    url: '/cart/getCartById',
    method: 'post',
    data
  })
}

export function page(data) {
  return request({
    url: '/product/info?&page=' + data.Page + '&pageSize=' + data.ageSize,
    method: 'get'
  })
}

// /' + data.pagesize + '/' + data.pagenum
export function addList(data) {
  return request({
    url: '/product/add',
    method: 'post',
    data
  })
}

export function updateList(data) {
  return request({
    url: '/product/update',
    method: 'post',
    data
  })
}

export function deleteList(data) {
  return request({
    url: '/product/delete',
    method: 'post',
    data
  })
}

export function uploadFile(data) {
  return request({
    url: '/common/upload',
    headers: { 'Content-Type': 'multipart/form-data;charset=utf-8' },
    method: 'post',
    data
  })
}
